package class_test.test1_0330;

import java.util.GregorianCalendar;

/**
 * @author haomin
 * @date 2022/03/30 17:30
 **/
public class MyDateTest {
    public static void main(String[] args) {
        MyDate myDate = new MyDate();
        System.out.println("年月日："+ myDate.getYear() +"."+ (myDate.getMonth()+1) +"."+ myDate.getDay());

        MyDate newMyDate = new MyDate(34355555133101L);
        System.out.println("年月日："+ newMyDate.getYear() +"."+ (newMyDate.getMonth()+1) +"."+ newMyDate.getDay());
    }
}

class MyDate{
    private int year,month,day;
    private long x;

    public MyDate() {
        int year,month,dayOrMonth;
        GregorianCalendar gc = new GregorianCalendar();

        this.year = gc.get(gc.YEAR);
        this.month = gc.get(gc.MONTH);
        this.day = gc.get(gc.DAY_OF_MONTH);
    }

    public MyDate(long x){
        GregorianCalendar gc = new GregorianCalendar();
        gc.setTimeInMillis(x);

        this.year = gc.get(gc.YEAR);
        this.month = gc.get(gc.MONTH);
        this.day = gc.get(gc.DAY_OF_MONTH);
    }

    public int getMonth() {
        return month;
    }
    public int getDay() {
        return day;
    }
    public int getYear() {
        return year;
    }
    public void setDate(long x) {
        this.x = x;
    }
}